package com.system.enterprisemanagementsystem.service.impl;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.system.enterprisemanagementsystem.mapper.OperateLogMapper;
import com.system.enterprisemanagementsystem.pojo.Emp;
import com.system.enterprisemanagementsystem.pojo.EmpQueryParam;
import com.system.enterprisemanagementsystem.pojo.OperateLog;
import com.system.enterprisemanagementsystem.pojo.PageResult;
import com.system.enterprisemanagementsystem.service.OperateLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class OperateLogServiceImlp implements OperateLogService {

    @Autowired
    OperateLogMapper operateLogMapper;


    @Override
    public PageResult page(Integer page, Integer pageSize) {
        //1. 设置分页参数
        PageHelper.startPage(page,pageSize);

        //2. 执行查询
        List<OperateLog> operateLogList = operateLogMapper.list();
        Page<OperateLog> p = (Page<OperateLog>) operateLogList;

        //3. 封装结果
        return new PageResult(p.getTotal(), p.getResult());
    }
}
